<?php
if (isset($InputData["user_avatar"])) {
    //获取用户头像
    if (isset($InputData["user_name"])) {
        $userC = "Name";
        $user = $InputData["user_name"];
    } else if (isset($InputData["user_id"])) {
        $userC = "Id";
        $user = $InputData["user_id"];
    }
    if (isset($userC)) {
        //连接用户数据模型
        require_once("{$CfgPara->root}/model/user.m.php");
        $myUser = new user_m($CfgPara->database);
        $result = $myUser->user_msg($userC, $user);
        if (is_string($result)) {
            echo $result;
        } else if (is_object($result)) {
            if (isset($result->Avatar) && $result->Avatar != '') {
                // 返回id|avatar
                echo "{$result->Id}|{$result->Avatar}";
            } else {
                echo "{$result->Id}|{$CfgPara->httproot}/avatar/default.png";//默认的头像
            }
        }
    }
} elseif (isset ($InputData['user_balance']) && isset ($_SESSION['user_id'])) {
    // 获取用户余额
    //连接用户数据模型
    require_once("{$CfgPara->root}/model/user.m.php");
    $myUser = new user_m($CfgPara->database);
    $result = $myUser->user_msg('Id', $_SESSION['user_id']);
    if (is_string($result)) {
        echo $result;
    } elseif (is_object($result)) {
        if (isset($result->Balance)) {
            echo $result->Balance;
        } else {
            echo '无法获得用户余额';
        }
    }
}